package com.it.controller;

import com.it.entity.preClaim.AiPreClaim;
import com.it.service.AiPreClaimService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import utils.R;

/**
 * <p>
 * 预赔信息表（农户申请理想赔付及领导审核记录） 前端控制器
 * </p>
 *
 * @author lutao
 * @since 2025年09月24日
 */
@RestController
@RequestMapping("/aiPreClaim")
public class AiPreClaimController {

    @Autowired
    private AiPreClaimService aiPreClaimService;

    //查询预赔列表
    @GetMapping("/list")
    public R list(@RequestParam(value = "pageNum",required = false,defaultValue = "1") Integer pageNum,
                  @RequestParam(value = "pageSize",required = false,defaultValue = "2") Integer pageSize,
                  @RequestParam(value = "reviewResult",required = false) Integer reviewResult,
                  @RequestParam(value = "preClaimStatus",required = false) Integer preClaimStatus,
                  @RequestParam(value = "reportId",required = false) String reportId){

        return aiPreClaimService.aiPrelist(pageNum,pageSize,reviewResult,preClaimStatus,reportId);
    }

    //添加预赔信息(申请预赔)
    @PostMapping("/add")
    public R add(@RequestBody AiPreClaim aiPreClaim){
        return aiPreClaimService.add(aiPreClaim);
    }

    //审核环节更新内容和状态
    @PutMapping("/update")
    public R update(@RequestBody AiPreClaim aiPreClaim){
        return aiPreClaimService.updateByReportId(aiPreClaim);
    }
}
